package com.generic.core;

import java.util.ArrayList;

public class GenericStack<E> {
	private ArrayList<E> list = new ArrayList<E>();
	
	public synchronized int getSize() {
		return list.size();
	}
	
	public synchronized E peek() {
		return list.get(list.size() - 1);
	}
	
	public synchronized E pop() {
		E result = list.get(list.size() - 1);
		list.remove(list.size() - 1);
		return result;
	}
	
	public synchronized void push(E o) {
		list.add(o);
	}
	
	public synchronized boolean isEmpty() {
		return list.isEmpty();
	}
}
